import axios from '@/http-config/http'; // 引入http配置
// 演习管理
export const drillAPI =  {
    page(params) {
        return axios['maneuver-scenario'].get('/maneuver/list', {
            page: params.pageNo,
            rows: params.pageSize,
            type: 0
        })
    },
    create(data) {
        return axios['maneuver-scenario'].postJson('/maneuver', {
            ...data,
        })
    },
    update(data) {
        return axios['maneuver-scenario'].postJson('/maneuver/update', {
            ...data,
        })
    },
    delete(ids) {
        return axios['maneuver-scenario'].postJson('/maneuver/delete?id=' + ids[0])
    },
    // 启用的想定分页
    unReleasexiangdingPage(params) {
        return axios['maneuver-scenario'].get('/scenario/list', {
            page: params.pageNo,
            rows: params.pageSize,
            maneuverId: params.maneuverId
        })
    },
    // 关联的想定列表
    releasexiangdingPage(params) {
        return axios['maneuver-scenario'].get('/maneuverScenarioRela/list',{
            page: params.pageNo,
            rows: params.pageSize,
            maneuverId: params.maneuverId
        } )
    },
    // 关联想定
    releaseXiangding(id, ids) {
        return axios['maneuver-scenario'].postJson('/maneuverScenarioRela', {
            maneuverId: id,
            scenarioIds: ids
        })
    },
    // 删除想定
    unReleaseXiangding(maneuverId,scenarioId) {
        return axios['maneuver-scenario'].postJson(`/maneuverScenarioRela/cancel?maneuverId=${maneuverId}&scenarioId=${scenarioId}`)
    },

}
// 演习详情
export const drillDetailAPI = {
    page(params) {
        return axios['maneuver-scenario'].get('/maneuver/list', {
            page: params.pageNo,
            rows: params.pageSize,
            type: 2
        })
    },
    // 根据演习id查询已发布的想定列表
    wantToBeList(maneuverId) {
        return axios['maneuver-scenario'].get('/maneuverConduct/releaseScenarioList', {
            maneuverId,
        })
    },
    // 作战时间
    getDate(maneuverId) {
        return axios['maneuver-scenario'].get('/maneuver/fightTimeSetting', {
            maneuverId
        })
    },
    // 设置作战时间
    setDate(data) {
        return axios['maneuver-scenario'].postJson('/maneuver/fightTimeSetting', data)
    },
    // 发布想定
    publishXiangding(data) {
        return axios['maneuver-scenario'].postJson('/maneuverConduct', data)
    },
    // 发布特请
    publishTeqing(data) {
        return axios['maneuver-scenario'].post('/maneuverConduct/specialScenario', data)
    },
    // 处置意见
    getHandleOptions(params) {
        return axios['maneuver-scenario'].get('/maneuverConduct/opinionList', params)
    },
    // 创建流转处置意见
    createLiuzhuanOptions(data) {
        return axios['maneuver-scenario'].post('/maneuverConduct/circulationOpinion', data)
    },
    updateLiuzhuanOptions(data) {
        return axios['maneuver-scenario'].postForm('/maneuverConduct/circulationOpinion', data)
    },
    // 处置意见
    createHandleOptions(data) {
        return axios['maneuver-scenario'].postForm('/scenarioOpinion', data)
    },
    updateHandleOptions(data) {
        return axios['maneuver-scenario'].postForm('/scenarioOpinion', data)
    },
    // 历史记录
    optionsPage(params) {
        return axios['maneuver-scenario'].get('/scenarioOpinion/list', {
            page: params.pageNo,
            rows: params.pageSize,
            maneuverId: params.maneuverId
        })
    },
    readHandleOptions(id) {
        return axios['maneuver-scenario'].get('/scenarioOpinion/details', {
            id
        })
    }

}
// 想定
export const wantToBeAPI =  {
    page(params) {
        return axios['maneuver-scenario'].get('/scenario/list', {
            page: params.pageNo,
            rows: params.pageSize
        })
    },
    create(data) {
        return axios['maneuver-scenario'].postForm('/scenario', data)
    },
    update(data) {
        return axios['maneuver-scenario'].postForm('/scenario/update', data)
    },
    delete(ids) {
        return axios['maneuver-scenario'].postJson('/scenario/delete?id=' + ids[0])
    },
    read(id) {
        return axios['maneuver-scenario'].get('/scenario/details?id=' + id)
    }
}
// 演习设置
export const drillSettingAPI =  {
    page(params) {
        return axios['maneuver-scenario'].get('/maneuver/list', {
            page: params.pageNo,
            rows: params.pageSize,
            type: 1
        })
    },
    update(data) {
        return axios['maneuver-scenario'].postJson('/maneuverSetting', data)
    },
    read(id) {
        return axios['maneuver-scenario'].get('/maneuverSetting/details', { maneuverId: id})
    },
    publish(params) {
        return axios['maneuver-scenario'].get('/maneuverSetting/release', params)
    }
}

// 字典数据
export const dictAPI = {
    // 机构列表
    getOrgList() {
        return axios['cloud-system-manage'].postJson('/ou/org/list?page=1&rows=99999')
    },
    // 用户列表
    getUserList() {
        return axios['cloud-system-manage'].postJson('/ou/emp/list-all', {})
    },
    // 根据机构获取用户列表
    getUserListByOrgId(orgId) {
        return axios['cloud-system-manage'].post('/ou/emp/listEmp?page=1&rows=9999&progeny=false&id=' + orgId)
    }
}
// 判断角色类型
export const userAPI = {
    getRoleType(params) {
        return axios['maneuver-scenario'].get('/maneuverConduct/role', params)
    }
}

